// pages/user/extendHome/extendHome.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userInfo: '',
    cash_available: 0,//可提现金额
    temp_money: 0,//冻结金额
    extend_moneybg_img: app.globalData._network_path + 'extend-moneybg.png',
    channel_adImg: app.globalData._network_path + 'channel_ad.png',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getUserInfo();
    this.dealerIncome();
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  getUserInfo() {
    var that = this;
    app.ajax({
      url: 'User/User/getUserInfo',
      method: "POST",
      data: {},
      success: function (res) {
        if (res.data.code == 1000) {
          that.setData({
            userInfo: res.data.data
          })
        }
      }
    })
  },
  // 获取推广列表
  dealerIncome() {
    var that = this;
    app.ajax({
      url: 'User/Spread/index',
      method: "POST",
      data: {},
      success: function (res) {
        if (res.data.code == 1000) {
          that.setData({
            cash_available: res.data.data.worker.cash_available,
            temp_money: res.data.data.worker.temp_money
          })
        }
      }
    })
  },

  // 提现
  cashWithdrawal() {
    wx.navigateTo({
      url: '/pages/user/accounputForward/accounputForward?role=6',
    })
  },

  // 邀请好友
  promotionFriends() {
    wx.navigateTo({
      url: '../myInvite/myInvite',
    })
    
  },
  invitation(){
    wx.navigateTo({
      url: '/pages/marketing/marketing',
    })
  },

  // 我要送券
  giveCoupon() {
    wx.navigateTo({
      url: '../giveCoupon/giveCoupon',
    })
  },

  // 我的经销商码
  mycode() {
    wx.navigateTo({
      url: '../myQRcode/myQRcode',
    })
  },

  // 我的业绩
  seeAll() {
    wx.navigateTo({
      url: '../spreadRecord/spreadRecord',
    })
  },

  // 我要报备
  myReport() {
    wx.navigateTo({
      url: '../reportList/reportList',
    })
  },

  //业绩考核
  achieveInspect(){
    wx.navigateTo({
      url: '../spreadInspection/spreadInspection',
    })
  },
  //存款
  stockManage(){
      wx.navigateTo({
        url: '../stockManage/stockManage',
      })
  },


})